using System;
using DNT.RavenQA.Core.Extensions;
using DNT.RavenQA.Core.Models;

namespace DNT.RavenQA.Core
{
    public class DenormalizedReference<T> where T : class, INamedDocument
    {
        public String Id { get; internal set; }
        public String Name { get; internal set; }

        public static implicit operator DenormalizedReference<T>(T document)
        {
            document.EnsureIsNotNull("document");
            return new DenormalizedReference<T>
                       {
                           Id = document.Id,
                           Name = document.Name
                       };
        }
    }
}